<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>保修列表</title>
<link type="text/css"  href="../style/style.css" rel="stylesheet"/>
<link type="text/css" href="../../../style/theme/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../js/jquery-ui-personalized.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/dormSupervisor.js"></script>
<script type="text/javascript" src="../js/propertyWork.js"></script>


</head>
<body>
	<div class="ajaxMessage"></div>
	<h1>${dormSupervisor.building.name}的保修列表</h1>
	<form action="repairList.do" method="get" name="repairDTO">
		<input type="hidden" name="building" value="${dormSupervisor.building.id }"/>
		<div class="filterForm">
			<select name="type">
				<option value="building">楼栋</option>
				<option value="dormitory">寝室</option>
			</select>
			<span class="dormitoryInput">
				<label for="dormitoryName">寝室</label>
				<input type="text" maxlength="10" name="dormitoryName" id="dormitoryName"/>
				<span class="warning"></span>
			</span>
			<label for="processed">受理</label>
			<input type="checkbox" name="processed" id="processed"/>
			<label for="applied">处理</label>
			<input type="checkbox" name="applied" id="applied"/>
			<label for="fromDate">起始时间</label>
			<input type="text" name="fromDate" id="fromDate" class="datepicker"/>
			<label for="toDate">结束时间</label>
			<input type="text" name="toDate" id="toDate" class="datepicker"/>
			<input type="submit" name="submit" value="查询"/>
		</div>
	</form>
	<c:choose>
		<c:when test="${!empty repairs.list}">
			<table id="repairs" border="1px">
		    	<thead>
		    		<tr>
						<th colspan="7">报修单</th>
					</tr>
		    		<tr>
		    			<td>ID</td><td>原因</td><td>请求日期</td>
		    			<td>寝室</td><td>受理状态</td><td>处理状态
		    			</td><td>操作</td>
		    		</tr>
		    	</thead>
		    	<tbody>
		    		<c:forEach items="${repairs.list}" var="repair">
			        <tr>
			        	<td>${repair.id }</td>
			        	<td>${repair.reason }</td>
			        	<td><fmt:formatDate value="${repair.requestDate}" dateStyle="LONG" type="both"/></td>
			        	<td>${repair.dormitory.name }</td>
			        	<td>
			        	状态<input type="checkbox" value="${repair.id }" 
			        						name="processed" 
			        						${repair.status.processed ?  "checked='checked'" : "" } 
			        						${repair.status.applied ? "disabled=\"disabled\"" : "" }/>
						</td>
			        	<td>状态
			        		<input type="checkbox" value="${repair.id }" 
			        						name="applied" 
			        						${repair.status.applied ? "checked='checked'" : "" }/>
			        	</td>
			        	<td>
			        		<button class="deleteButton" name="deleteRepair" value="${repair.id}">删除</button>
			        		
			        	</td>
			        						
			        </tr>
		       		</c:forEach>
		        </tbody>
		        <div class="confirm"><p></p></div>
		        <div class="returnMessage"><p></p></div>
		    </table>
  		</c:when>
		<c:otherwise>
			<p>列表为空</p>
		</c:otherwise>
	</c:choose>
</body>
</html>